package com.hqyj.paimaisys.util;

import org.springframework.format.annotation.DateTimeFormat;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    public static boolean isValidTime(Date date, String stime, String etime){
        try {
            long now = date.getTime();
            long start = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(stime).getTime();
            long end = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(etime).getTime();
            return now >= start && now <= end;
        }catch(Exception e){

        }
        return false;
    }
}
